﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MbUnit.Framework;
namespace App.Lib.Service.Impl.Test
{
	[TestFixture]
	public class TestWeekFunction
	{
		public static WeekFunction instance;
		[TestFixtureSetUp]
		public void Initialize()
		{
			instance=new WeekFunction();	
		}

		[Test]
		public void TestGetWorktimeInThisWeek()
		{
			DateTime dt=new DateTime(2009,8,23);
			string actual=instance.GetWorktimeInThisWeek(dt);
			string expected="2009.8.17-2009.8.21";
			Assert.AreEqual(expected,actual);
		}
		[Test]
		public void TestGetWorktimeInNextWeek()
		{
			DateTime dt = new DateTime(2009, 8, 23);
			string actual = instance.GetWorktimeInNextWeek(dt);
			string expected = "2009.8.24-2009.8.28";
			Assert.AreEqual(expected, actual);
		}
		[Test]
		public void TestGetWeekAtYear()
		{
			DateTime dt = new DateTime(2009, 1, 5);
			Console.WriteLine(dt.DayOfYear);
			Console.WriteLine(dt.DayOfWeek);
			Console.WriteLine(Convert.ToInt32(dt.DayOfWeek));
			int actual = instance.GetWeekAtYear(dt);
			Console.WriteLine("haha:"+actual.ToString());
			int expected = 2;
			Assert.AreEqual(expected, actual);
		}
	}
}
